/*****************************************************************************

File:   otkUpdateLayerStateExample.java

Date          Build     Author        Version    Comments
18-Sep-12    P-20-14    dshah          $$1        Created
12-Oct-12    P-20-14    dshah          $$2        Updated
20-mar-15 P-30-05 gshmelev $$3  called GetCurrentSession

****************************************************************************/

/* 
   
Example for layer state.

*/

package com.ptc.otkjavaexamples;

import com.ptc.cipjava.*;
import com.ptc.pfc.pfcSession.*;
import com.ptc.pfc.pfcCommand.*;
import com.ptc.pfc.pfcGlobal.*;
import com.ptc.pfc.pfcModel.*;
import com.ptc.pfc.pfcModelItem.*;
import com.ptc.pfc.pfcFeature.*;
import com.ptc.pfc.pfcSolid.*;
import javax.swing.JOptionPane;
import java.io.*;

import com.ptc.cipjava.*;
import com.ptc.pfc.pfcFamily.*;
import com.ptc.pfc.pfcServer.*;
import com.ptc.pfc.pfcWindow.*;
import com.ptc.wfc.wfcSolid.*;
import com.ptc.wfc.wfcLayerState.*;


//Update existing layer state

class otkUpdateLayerStateExample extends DefaultUICommandActionListener
{
    
    
    
    public otkUpdateLayerStateExample()
    {
    }
    
    
    
    
    public void OnCommand()
    {
	addUpdateLayerStateExample();
    }
    
    
    public int addUpdateLayerStateExample()
    {
	try
	    {
			
		Session session = pfcSession.GetCurrentSession ();
		WSolid WSolid = (WSolid)(session.GetCurrentModel());
		
		LayerState WLayerState = otkLayerStateUtils.otkUtilSelectLayerState(WSolid, (int) -1);
		
		if(WLayerState != null)
		    otkLayerStateUtils.otkUtilUpdateLayerState(WSolid, WLayerState, -1, null, -1, -1);
		
		return (0);
	    }
	catch (Exception e)
	    {
		System.out.println("1: " + e);
	    }
	return (0);
    }

};






